package com.example.twoservice.rpc;

import com.example.dubbo.dto.ProductDto;
import com.example.twoservice.domain.Product;
import com.example.dubbo.service.ProductServiceApi;
import com.example.twoservice.service.ProductService;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @description:
 * @author: yunchong.yang
 * @Date: 2021/6/7
 */
@Service
public class ProductProviderRpc implements ProductServiceApi {

    @Autowired
    private ProductService productService;

    @Override
    public void insert(ProductDto productDto) {
        Product p = new Product();
        p.setId(productDto.getId());
        p.setNum(productDto.getNum());
        p.setName(productDto.getName());
        productService.addProduct(p);
    }
}
